/*
 * @Author: Lizhenyu
 * @Date: 2021-08-09 14:11:34
 * @FilePath: \usp-osm-frondend\src\api\coupon.js
 */
import { service } from '@/utils/request'

const api = {
  couponList: '/admin/promotion/couponMaster/pageList',
  couponEdit: '/admin/promotion/couponMaster/save',
  couponDetail: '/admin/promotion/couponMaster/selectDetail',
  takeId: '/admin/promotion/couponMaster/takeEffect',
  checkCoupon: '/admin/promotion/couponMaster/expirationCheck',
  // 券码列表
  couponCodeList: '/admin/promotion/couponList/pageList',
  isFrozen: '/admin/promotion/couponList/isFrozen',
  downloadTemplate: '/admin/promotion/couponList/downloadTemplate',
  // 券码导入列表
  couponTempList: '/admin/promotion/couponImport/pageList',
  checkFailInfo: '/admin/promotion/couponImport/viewFailure',
  importTemplate: '/admin/promotion/couponImport/importTemplate'

}
/**
 * 券池管理
*/
export function getCoupon (data) {
  return service({
    url: api.couponList,
    method: 'post',
    data
  })
}

export function saveCoupon (data) {
  return service({
    url: api.couponEdit,
    method: 'post',
    data
  })
}

export function getCouponDetail (data) {
  return service({
    url: api.couponDetail,
    method: 'post',
    data
  })
}

export function getValidCoupon (data) {
  return service({
    url: api.takeId,
    method: 'post',
    data
  })
}

export function checkCoupon () {
  return service({
    url: api.checkCoupon,
    method: 'get'
  })
}
/**
 * 券码列表
*/
export function getCouponCodeList (data) {
  return service({
    url: api.couponCodeList,
    method: 'post',
    data
  })
}

export function isFrozen (data) {
  return service({
    url: api.isFrozen,
    method: 'post',
    data
  })
}

/**
 * 券码导入列表
*/

export function getCouponTempList (data) {
  return service({
    url: api.couponTempList,
    method: 'post',
    data
  })
}

export function checkFailInfo (data) {
  return service({
    url: api.checkFailInfo,
    method: 'post',
    data
  })
}
